﻿using DevTeam;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;

namespace ConfExpert.Forms.Depo
{
    public partial class AranacakToplar : XPopupForm
    {
        public AranacakToplar()
        {
            InitializeComponent();
        }

        BindingSource bs;
        private void AranacakToplar_Load(object sender, EventArgs e)
        {

            bs = new BindingSource(ds, "AranacakToplar");
            GetDetails("AranacakToplar", "GetAranacakToplar");

            ArrayList aList = new ArrayList(ds.AranacakToplar.Rows.Count);
            foreach (DataRow row in ds.AranacakToplar.Rows)
                aList.Add(row["RollId"]);

            memoEdit1.Text = String.Join(Environment.NewLine, aList.ToArray());

            btnKaydet.ItemClick += btnKaydet_ItemClick;


        }

        void btnKaydet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            List<string> liste = new List<string>();
            foreach (string str in memoEdit1.Text.Split(Environment.NewLine.ToCharArray()))
                if (intParse(str) > 0)
                    liste.Add(str);

            ds.AranacakToplar.Clear();
            GetDetails("AranacakToplar", "UpdAranacakToplar", String.Join(";", liste.ToArray()));

            ArrayList aList = new ArrayList(ds.AranacakToplar.Rows.Count);
            foreach (DataRow row in ds.AranacakToplar.Rows)
                aList.Add(row["RollId"]);

            memoEdit1.Text = String.Join(Environment.NewLine, aList.ToArray());

            //this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }


    }
}